package com.xzakota.minesweeper.msg;

import com.xzakota.minesweeper.model.entity.UserBean;

/**
 * 单个房间消息基类
 *
 * @author Xzakota
 */
public abstract class RoomMsg extends BaseMsg implements IUserMsg, IRoomMsg {
    @Override
    public int getRoomNum() {
        int room = 0;
        Object[] msg = (Object[]) this.data;
        if (msg[1] instanceof Integer) {
            room = (int) msg[1];
        }
        return room;
    }

    @Override
    public UserBean getUser() {
        UserBean user = null;
        Object[] msg = (Object[]) this.data;
        if (msg[0] instanceof UserBean) {
            user = (UserBean) msg[0];
        }
        return user;
    }
}
